package acm;

import java.util.Scanner;

public class 基本型 {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int n=in.nextInt();
        long sum=1;
        int i=1;
        while (n>0){
            i++;
            if (isprme(i)){
                sum=(sum*i)%50000;
                n--;
            }
        }
        System.out.print(sum);

    }
    public static boolean isprme(int i){
        int j;
        for ( j=2;j<=Math.sqrt(i);j++){
            if (i%j==0){
                return false;
            }
        }
            return true;
    }
}
